package thread;
// abc线程 打印cba
public class ThreadDemo17 {
    public static void main(String[] args) {
        Object locker = new Object();

        Thread c = new Thread(() ->{
            System.out.print(Thread.currentThread().getName() + " ");
        },"c");

        Thread b = new Thread(() ->{
            try {
                c.join();
                System.out.print(Thread.currentThread().getName() + " ");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        },"b");


        Thread a = new Thread(() ->{
            try {
                b.join();
                System.out.print(Thread.currentThread().getName() + " ");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        },"a");
        a.start();
        b.start();
        c.start();
    }
}
